App({

  /**
   * 当小程序初始化完成时，会触发 onLaunch（全局只触发一次）
   */
  onLaunch: function () {
    const systemInfo = wx.getSystemInfoSync();
    const statusBarHeight = systemInfo.statusBarHeight
    const buttonTop =  wx.getMenuButtonBoundingClientRect().top
    const buttonHeight =  wx.getMenuButtonBoundingClientRect().height
    const navBarHeight = (buttonTop-statusBarHeight)*2  + buttonHeight
    wx.setStorageSync('statusBarHeight', statusBarHeight)
    wx.setStorageSync('navBarHeight', navBarHeight)
  },

  /**
   * 当小程序启动，或从后台进入前台显示，会触发 onShow
   */
  onShow: function (options) {
    wx.createSelectorQuery().selectAll('#myTabbar').boundingClientRect(function(rect){
      console.log(rect); 
    }).exec()
  },

  /**
   * 当小程序从前台进入后台，会触发 onHide
   */
  onHide: function () {
    
  },

  /**
   * 当小程序发生脚本错误，或者 api 调用失败时，会触发 onError 并带上错误信息
   */
  onError: function (msg) {
    
  }
})
